#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void solve(){
    string s;
    cin>>s;
    bool f1=0;
    int cnt=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='1')f1=1;
        if(s[i]=='0'){
            if(f1){
                cnt++;
                f1=0;
            }
        }
    }
    cout<<cnt<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();

    return 0;
}